package com.avic.process.utils;

import java.awt.Component;

import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;

import com.avic.process.utils.SpecialSymbolUtil;
import com.avic.process.utils.TolerancePanel;

public class TableCellTolerancePanelEditor extends AbstractCellEditor implements TableCellEditor{

	private static final long serialVersionUID = 1L;
	private TolerancePanel panel;
	
	@Override
	public Component getTableCellEditorComponent(JTable table, Object value,
			boolean isSelected, int row, int column) {
		table.changeSelection(row, column, false, false);
		panel = new TolerancePanel();
		SpecialSymbolUtil.insetTolerancePanel = panel.pane;
		SpecialSymbolUtil.table = table;
		SpecialSymbolUtil.count = 1;
		SpecialSymbolUtil.row = row;
		SpecialSymbolUtil.col = column;
		panel.setString(String.valueOf(value));
		return panel;
	}

	@Override
	public Object getCellEditorValue() {
		return panel.getString();
	}

}
